MyUserPaneKeyDownProc
NEW WITH THE APPEARANCE MANAGER
Handles keyboard event processing.The Control Manager declares the type for an application-defined user pane key down function as follows:
typedef pascalControlPartCode(*ControlUserPaneKeyDownProc)( ControlHandle control SInt16 keyCode, SInt16 charCode, SInt16 modifiers);The Control Manager defines the data typeUserPaneKeyDownUPP
to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr ControlUserPaneKeyDownUPP;You typically use theNewControlUserPaneKeyDownProc
macro like this:
ControlUserPaneKeyDownUPP
myControlUserPaneKeyDown
UPP;
myControlUserPaneKeyDown
UPP = NewControlUserPaneKeyDown
Proc
(MyUserPaneKeyDown
);You typically use the
CallControlUserPaneKeyDownProc
macro like this:
Call
ControlUserPaneKeyDown
Proc(myControlUserPaneKeyDown
UPP, control, keyCode, charCode, modifiers);Here's how to declare the function
MyUserPaneKeyDownProc:
pascal ControlPartCode MyUserPaneKeyDownProc ( ControlHandle control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers);
control
- A handle to the control in which the keyboard event occurred.
keyCode
- The virtual key code derived from event structure. This value represents the key pressed or released by the user. It is always the same for a specific physical key on a particular keyboard regardless of which modifier keys were also pressed.
charCode
- A particular character derived from the event structure. This value depends on the virtual key code, the state of the modifier keys, and the current
'KCHR'
resource.modifiers
- The constant in the
modifiers
field of the event structure specifying the state of the modifier keys and the mouse button at the time the event was posted.- function result
- Returns the part code of the control where the keyboard event occurred. If the keyboard event did not occur in a control, your function should return
kControlNoPart
.DISCUSSION
YourMyUserPaneKeyDownProc
function should handle the key pressed or released by the user and return the part code of the control where the keyboard event occurred. This function will only get called if you've set thekControlSupportsFocus
feature bit on creation of the user pane control. Once you have created the functionMyUserPaneKeyDownProc
, passkControlUserPaneKeyDownProcTag
in thetagName
parameter ofSetControlData
.